package org.example;

import jdk.nashorn.internal.ir.annotations.Reference;
import org.example.serviceinterface.EchoService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@EnableDiscoveryClient
@SpringBootApplication
@RestController
public class ConsumerServiceApplication {

    @Reference
    private EchoService echoService ;

    public static void main(String[] args) {
        SpringApplication.run(ConsumerServiceApplication.class,args) ;
    }

    @GetMapping("/rpc")
    public ResponseEntity<String> rpc(){
        return ResponseEntity.ok(String.format("调用结果为%s",echoService.echo("info")));
    }
}
